package test03;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class BookTest {
	private static Book book = new Book();
	private String str;
	private String strRes;
	private int n;
	
	public BookTest(String str, String strRes, int n) {
		this.str = str;
		this.strRes = strRes;
		this.n = n;
	}
	
	@Parameters
	public static Collection<?> date(){
		return Arrays.asList(new Object[][] {
			{"qwe","q",1},{"wwweeeqqqqqqq","qqq",2},{"zzx","z",2}
		});
	}
	
	@Test
	public void test() {
		int num = book.search2(str, strRes);
		assertEquals(num, n);
	}
}
